package org.jsoupx;

import java.io.IOException;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class JsoupX {
	
	public int timeOut = 999;
	private Connection conn;
	private Document doc;

	public JsoupX() {
	}

	public JsoupX(Connection conn) {
		this.conn = conn;
	}
	
	public static JsoupX connect(String url) {
		return new JsoupX(Jsoup.connect(url));
	}

	public JsoupX timeout(int time) {
		timeOut = time;
		return this;
	}

	public DocumentX get() throws IOException {
		doc = conn.timeout(timeOut).get();
		DocumentX d = new DocumentX(doc);
		d.all();
		return d;
	}
	
	public DocumentX post() throws IOException {
		doc = conn.timeout(timeOut).post();
		DocumentX d = new DocumentX(doc);
		d.all();
		return d;
	}
	
	
	
	
}
